﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WJPClient.Common
{
    /// <summary>
    /// DBUpdate.xaml 的交互逻辑
    /// </summary>
    public partial class DBUpdate : Window
    {
        ObservableCollection<string> ConnectList = new ObservableCollection<string>();
        ObservableCollection<string> EntityTypeList = new ObservableCollection<string>();

        public DBUpdate()
        {
            InitializeComponent();

            InitData();
            InitControl();
        }

        private void InitData()
        {
            ConnectList.Add("测试1" );
            ConnectList.Add("测试2" );
            ConnectList.Add("测试3" );
        }

        private void InitControl()
        {
            modelListBox.ItemsSource = ConnectList;
            entityListBox.ItemsSource = EntityTypeList;
        }

        #region 命令

        public static RoutedUICommand Update = new RoutedUICommand();

        private void Update_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {

        }

        private void Update_Executed(object sender, ExecutedRoutedEventArgs e)
        {

        }

        #endregion

        private void Model_Checked(object sender, RoutedEventArgs e)
        {
            var checkBox = sender as CheckBox;
            EntityTypeList.Add(checkBox.Content.ToString() + "实体1");
            EntityTypeList.Add(checkBox.Content.ToString() + "实体2");
            EntityTypeList.Add(checkBox.Content.ToString() + "实体3");
        }

        private void Model_Unchecked(object sender, RoutedEventArgs e)
        {

        }
    }
}
